package com.saas.service.impl;

import com.saas.dao.ProductsDao;
import com.saas.pojo.Products;
import com.saas.service.IProductsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductsServiceImpl implements IProductsService {

    @Autowired
    private ProductsDao pd;
    @Override
    public List<Products> getAllProducts() {
        return pd.getAllProducts();
    }

    @Override
    public Products getProductById(Integer id) {
        return pd.getProductById(id);
    }

    @Override
    public boolean updateProduct(Products product) {
        return pd.updateProduct(product) > 0;
    }

    @Override
    public boolean deleteProduct(Integer id) {
        return pd.deleteProduct(id) > 0;
    }

    @Override
    public boolean saveProduct(Products product) {
        return pd.saveProduct();
    }

}
